﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ClickLogin(object sender, EventArgs e)
    {
        int userID = DataBase.Users.VerifyUser(txtUserName.Text, txtPassword.Text);

        if(userID > 0)
        {
            Session["userID"] = userID;
               
            if (Request.QueryString["return"] != null)
                Response.Redirect(Request.QueryString["return"]);
            else
                Response.Redirect("DisplayWeek.aspx");

        }
        else if (userID == 0)
        {
            lblErrorMessage.Text = "Invalid Password";

        }
        else
        {
            lblErrorMessage.Text = "Invalid UserName";
        }
    }
}